package xu.jiang.report.bean;

import lombok.Data;

@Data
public  class RowArea {

    /**
     * 起始行号
     */
    private int startRowIndex;
    /**
     * 结束行号
     */
    private int endRowIndex;

    //表格间的外边距
    private int marginHeight = 1;

    /**
     * 表格间的实际偏差
     */
    private int offsetInTables;



//    public RowArea(int startRowIndex, int endRowIndex) {
//        this.startRowIndex = startRowIndex;
//        this.endRowIndex = endRowIndex;
//        // 表格间的偏差
//        this.offsetInTables = (this.endRowIndex - this.startRowIndex) + this.marginHeight;
//
//    }

    public RowArea(int startRowIndex, int endRowIndex,int marginHeight) {
        this.startRowIndex = startRowIndex;
        this.endRowIndex = endRowIndex;
        this.marginHeight = marginHeight;
        // 表格间的偏差
        this.offsetInTables = (this.endRowIndex - this.startRowIndex+1) + this.marginHeight;

    }

    /**
     * 计算下一个区域
     * @return
     */
    public RowArea compute2NextArea(){

        //新模版的起始点
        return new RowArea(this.startRowIndex + offsetInTables,this.endRowIndex + offsetInTables,this.marginHeight);
    }
}
